/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-03-03
 * Time: 12:55
 */
/*final class A{

}
class B extends A{

}*/

/*class Student {

}

class Teacher {

}

class School {
    private Student student;
    private Teacher teacher;
}*/

class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(this.name + "吃东西");
    }

    /*public Animal eat1() {
        System.out.println(this.name + "eat : Animal");
        return null;
    }*/
}

class Dog extends Animal{
    public Dog(String name, int age) {
        super(name, age);
    }

    public void bark() {
        System.out.println(this.name + "汪汪汪");
    }
    public void eat() {
        System.out.println(this.name + "正在吃狗娘");
    }
    /*public Dog eat1() {
        System.out.println(this.name + "eat Dog");
    }*/
}

class Bird extends Animal{
    public Bird(String name, int age) {
        super(name, age);
    }

    public void zhizhi() {
        System.out.println(this.name + "吱吱吱");
    }

    @Override
    public void eat() {
        System.out.println(this.name + "吃鸟粮");
    }

    public void fly() {
        System.out.println(this.name + "在飞");
    }
}

public class Test {

    public static Animal func2() {
        return new Dog("小黑",5);
    }
    public static void func(Animal animal) {
        animal.eat();
    }

    public static void main(String[] args) {
        Animal animal = new Dog("xiaohuan2g",1);
        if(animal instanceof Bird) {
            Bird bird = (Bird)animal;
            bird.fly();
        }
        else {
            System.out.println("animal instanceof Bird not！");
        }
    }

    /*public static void main6(String[] args) {
        *//*Animal animal = new Dog("xiaohuan2g",1);
        Dog dog =(Dog)animal;
        dog.bark();*//*

        *//*Animal animal = new Dog("xiaohuan2g",1);
        Bird bird = (Bird)animal;
        bird.fly();*//*

    }*/

    /*public static void main5(String[] args) {
        Dog dog = new Dog("小黄",1);
        Bird bird = new Bird("小黑",2);
        func(dog);
        func(bird);
    }*/

    /*public static void main4(String[] args) {
        Animal animal2 = func2();
    }*/

    /*public static void main3(String[] args) {
        func(new Dog("小黄",4));

    }*/

    /*public static void main2(String[] args) {
        *//*Dog dog = new Dog();
        Animal animal = dog;*//*

        Animal animal1 = new Dog("小黄",5);
        animal1.eat();
        //animal1.bark();
    }*/

    /*public static void main1(String[] args) {
        final int SIZE = 10;
        SIZE = 100;
    }*/
}
